package org.enlongWu.controller;

import org.enlongWu.pojo.PageBean;
import org.enlongWu.pojo.Result;
import org.enlongWu.pojo.Role;
import org.enlongWu.pojo.User;
import org.enlongWu.service.RoleService;
import org.enlongWu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/role")
@Validated
public class RoleController {
    @Autowired//注入bean
    private RoleService roleService;


    /**
     * 查询权限集合
     *             包括admin系统管理员，engineer工程师，customer顾客 冷库拥有者，initial为新注册用户
     * @return  标准返回结果Result.data
     */
    @GetMapping("/list")
    public Result<PageBean<Role>> rolesList(Integer pageNum,
                                            Integer pageSize,
                                            @RequestParam(required = false) String searchString) {
        System.out.println("-----------------"+pageNum+pageSize+searchString);
        PageBean<Role> pb =  roleService.list(pageNum,pageSize,searchString);
        return Result.success(pb,"查询权限列表成功");
    }






}
